<?php
/**
 * Class which represents main body.
 *
 * @author Honza
 */
class MainBody {
  
  /**
   * Converts a class which implements IMainBody interface to right structure
   * @param IMainBodyWithSubMenu $iMainBody
   * @return type
   */
  public static function getMainBodyContent($iMainBody) {
    if ($iMainBody instanceof IMainBodyWithSubMenu) {
      //website with submenu
      $content = '';
      $content .= '<p class="submenu">';
      $content .= $iMainBody->getSubNavigation();
      $content .= '<p>';
      $content .= $iMainBody->getContent();
      
    } else {
      //simple website - no submenu
      $content = $iMainBody->getContent();
    }
    
    return $content;
  }
}

?>
